﻿Ext.define('app.prm.detail.DetailModel',
{
    extend: 'Ext.app.ViewModel',
    alias: 'viewmodel.detailmodel',
    constructor: function () {
        var me = this;
        this.callParent(arguments);
    },
    data: {
        pmId: 0,
        pm: '',
        projectStatus: '',
        projectNo: '',
        projectName: '',
        productNo: '',
        customer: '',
        customeCode: '',
        rdCenter: '',
        laboratory: '',
        business: '',
        planStartDate: '',
        planEndDate: '',
        planProgress: 0,
        actualStartDate: '',
        actualEndDate: '',
        actualProgress: 0,
        targetEndDate: '',
        qualityStandard: '',
        projectNature: '',
        address: '',
        taskType: '',
        remark: '',
        actualCost: 0,
        actualWorkCost: 0,
        targetWorkCost: 0,
        actualOutPut: 0,
        actualMaterialCost: 0,
        targetCost: 0,
        targetOutPut: 0,
        targetMaterialCost: 0,
        teamCommentStatus: 0,
        prmCommentStatus: 0,
        phaseIds: '',
        phaseText: '',
        hasDocument: false,
        hasFollowered: false,
        hasEditCost: false,
        hasEditInfo: false,
        hasEditProgress: false,
        hasEditTeam: false,
        hasSynthView: false,
        hasPlan: false,
        hasTopic: false,
        hasDeleteTeam: false,
        hasEditPhase: false,
        taskNote: '',
        hasAddTask: false,
        hasFollowerTask: false,
        hasTaskArchived: false,
        hasTaskExport: false,
        //下面两个权限用于 基本信息和项目阶段切换时使用
        hasBasicEdit: true,
        hasPhaseEdit: false,
        inquiryCount: 0,
        reportWeek: 1
    },
    formulas: {
        showSavePhase: function (get) {
            // return get('hasEditPhase') && get('projectStatus') == '进行中' && get('hasPhaseEdit');
            return get('hasEditPhase')  && get('hasPhaseEdit');
        },
        showEditInfo: function (get) {
            return get('hasEditInfo') && get('hasBasicEdit');
        },
        hideAbInquiryBtn: function (get) {
            return get('inquiryCount') == 0;
        },
        customerWeek: function (get) {
            return get('reportWeek') > 1 ? "双周报" : '单周报';
        }
    }
});